<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>

<head>
	<title>登录页</title>
	<script type="text/javascript">
		function register(){
			///window.location.href = '${ctx}/user/home/register';
			$("#loginForm").attr('action','${ctx}/register');
			document.loginForm.submit();
		}
		function login(){
			$("#loginForm").attr('action','${ctx}/login');
			document.loginForm.submit();
		}
		</script>
</head>
<body>
			<form:form id="loginForm" name="loginForm" action="${ctx}/login" method="post">
				<div class="top_b">唯爱婚礼后台管理平台</div>    
				<div class="alert alert-info alert-login">
					<%
						String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
						if(error != null){
					%>
						<font color="red">登录名或者密码错误，登录失败，请重试.</font>
						
					<%
						}else{
						
					%>
						请输入用户名和密码.
					
					<%
						}
					%>
				</div>
				<table>
					<tr>
					<td>用户名：</td><td><input type="text"  id="username" name="username"  value="" /></td>
					</tr>
					<tr>
					<td>密码：</td><td><input type="password"  id="password" name="password"  value="" /></td>
					</tr>
					<tr><td ><button  type="button" onclick="login()">登 录</button></td>
					<td ><button  type="button" onclick="register()">注 册</button></td>
					</tr>
				</table>
			</form:form>
    </body>
</html>
